import {getMenuList} from '../../../request/app'
//封装一个state接口
interface menuSate {
    menulist: Array<object>
}
 const state = {
    menulist:[]
}

 const getters = {
    getMenuList(state:menuSate){
        return state.menulist
    }
}

 const mutations = {
    REQ_LIST(state:menuSate,payload:any){
        state.menulist = payload
    }
}

 const actions = {
    getMenuListAction(context:any){
        getMenuList()
        .then((res:any)=>{
            console.log(res,'菜单列表');
            if(res.code == 200){
                context.commit('REQ_LIST',res.list)
            }
        })
    }
}

export default {
    state,
    getters,
    mutations,
    actions,
    namespaced:true
}